﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using HHBLL;
using HHModel;
using HHCommon;
using HHDBUtility;
namespace HHWeb.SystemManage.PagePowers
{
    public partial class Dispose : Base
    {
        Help help = new Help();
        HHCommon.PagePower pagepower = new HHCommon.PagePower();
        public string PagePowerName = string.Empty;
        public string TreePagePowerURL = string.Empty;
        public string PagePowerURL = string.Empty;
        public string Functionintro = string.Empty;
        public string OpenStatus = string.Empty;
        public string Command = string.Empty;
        public string PagePowerInfo = string.Empty;
        public string Creater = string.Empty;
        public string CreateTime = string.Empty;
        HHBLL.PagePower UBLL = new HHBLL.PagePower();
        HHModel.PagePower UModel = new HHModel.PagePower();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (help.GetHttpMethodBool())
            {
                UModel.PagePowerName = Request["PagePowerName"].ToString();
                UModel.ParentID =Convert.ToInt32(Request["ParentID"]);
                UModel.PagePowerUrl = Request["PagePowerURL"].ToString();
                UModel.OpenState = Request["OpenStatus"].ToString()=="1"?1:0;
                UModel.FunctionIntro = Request["Functionintro"].ToString();
                UModel.Creater = Request["Creater"].ToString();
                UModel.CreateTime =Convert.ToDateTime(Request["CreateTime"].ToString());
                UModel.LastUpdater = Request["Creater"].ToString();
                UModel.LastUpdateTime = Convert.ToDateTime(Request["CreateTime"].ToString());
                UModel.PagePowerName = Request["PagePowerName"].ToString();
                int i = UBLL.Add(UModel);
                if (i > 0)
                    MessageBox.ShowAndRedirect(this.Page, "操作成功！", "PagePowerList.aspx");
                else
                    MessageBox.ShowJS("操作失败！", "history.go(-1)");
            }
            else
            {
                OpenStatus = "1";
                PagePowerURL = "#";
                Command = "添加";
                PagePowerInfo = pagepower.GetPagePowerInfo("SELECT [ID] as ID,[PagePowerName] as Name, [ParentID] as ParentID FROM PagePower WITH(NOLOCK) WHERE OpenState=1");
                Creater = "yangei";
                CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
        }
    }
}